package com.design.flyweight;

import java.util.Hashtable;
// 就是把内容相同的 放在一个工厂里  然后如果有 不做实例化
public class FlyweightFactory {

    Hashtable hashtable=new Hashtable();
    public FlyweightFactory(){

    }
    public Flyweight getFlyweight(String str){
        ConcreteFlyweight str1 = (ConcreteFlyweight) hashtable.get("str");
        if(str1==null){
            str1 = new ConcreteFlyweight(str);
            hashtable.put(str,str1);
        }

        return str1;
    }



}
